package com.controller;

import org.springframework.util.StringUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * @author zhaoyifan
 * @date 2023/9/2 22:54
 */
public class BaseController {

    public Long getUserId(HttpServletRequest request){
        String userId = request.getHeader("userId");
        if(StringUtils.hasText(userId)){
              return Long.valueOf(userId);
        }
        return null;
    }

    public Long getStuId(HttpServletRequest request){
        String stuId = request.getHeader("stuId");
        if(StringUtils.hasText(stuId)){
            return Long.valueOf(stuId);
        }
        return null;
    }
}
